#!/usr/bin/perl

use utf8;
use strict;
use warnings;

my $what = 'fred|barney';

while (<>) {
	chomp;

	if ( /($what){3}/ ) {
		print "Matched: $what\n";
	}
}